<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计数器</title>
    <style>
        .rst {
            display: flex;
            margin: 0 5% 0 5%;
            background-color: rgb(40, 170, 100);
            height: 200px;
            color: #ffffff;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 100px;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
        }

        .btnarea {
            display: flex;
            padding: 50px 0 0 0;
            margin: 0 5% 0 5%;
            justify-content: center;

        }

        .btn {
            width: 100%;
            height: 100px;
            border: none;
            border-radius: 10px;
            background-color: rgb(120, 0, 255);
            font-family: Arial, Helvetica, sans-serif;
            font-size: 50px;
            color: #ffffff;
            
        }

        .btn:active {
            /* transition: all 1 ease; */
            /* transform:scale(1.1) ; */
            transform: scale(0.99);
            background-color: rgb(105, 0, 230);
            /* background-color: rgb(79, 60, 255); */

        }

        .plusbtnarea {
            display: flex;
            padding: 50px 0 0 0;
            margin: 0 5% 0 5%;
            justify-content: space-between;
        
        }

        .plusbtn{
            width: 150px;
            height: 100px;
            border: none;
            border-radius: 10px;
            background-color: rgb(255, 0, 120);
            font-family: Arial, Helvetica, sans-serif;
            font-size: 50px;
            color: #ffffff;
            border: 1px solid white;
        }

        .plusbtn:active {
            /* transition: all 1 ease; */
            /* transform:scale(1.1) ; */
            transform: scale(0.95);
            background-color: rgb(220, 0, 100);
            /* background-color: rgb(79, 60, 255); */

        }

        .btncls {
            width: 100%;
            height: 100px;
            border: none;
            border-radius: 10px;
            background-color: rgb(255, 0, 0);
            font-family: Arial, Helvetica, sans-serif;
            font-size: 30px;
            color: #ffffff;
        }

        .btncls:active {
            background-color: rgb(200, 0, 0);
            transform: scale(0.99);

        }
    </style>
</head>

<body>
    <div id="result" class="rst">0</div>
    <div class="plusbtnarea">
        <button type="button" class="plusbtn" onclick="Step1()">1</button>
        <button type="button" class="plusbtn" onclick="Step2()">2</button>
        <button type="button" class="plusbtn" onclick="Step5()">5</button>
        <button type="button" class="plusbtn" onclick="Step10()">10</button>
    </div>
    <div class="btnarea">
        <button id="plusbtn" type="button" class="btn" onclick="Plus()">+1</button>
    </div>

    

    <div class="btnarea">
        <button type="button" class="btncls" onclick="Cls()">清零</button>
    </div>

    <script>
        let res = 0;
        let step = 1;

        function Step1(){
            step = 1;
            document.getElementById("plusbtn").innerHTML = "+"+step;
        }
        function Step2(){
            step = 2;
            document.getElementById("plusbtn").innerHTML = "+"+step;
        }
        function Step5(){
            step = 5;
            document.getElementById("plusbtn").innerHTML = "+"+step;
        }
        function Step10(){
            step = 10;
            document.getElementById("plusbtn").innerHTML = "+"+step;
        }

        function Plus() {
            res = res + step;
            document.getElementById("result").innerHTML = res;
        }

        function Cls() {
            res = 0;
            document.getElementById("result").innerHTML = res;
        }

    </script>

</body>

</html>